#ifndef     _LIS3DHTR_H_
#define     _LIS3DHTR_H_
 

// LIS3DH Register Map - Ordered by Register Address
#define LIS3DH_STATUS_REG_AUX       0x07 // Status register, auxiliary ADC data ready and overrun flags
#define LIS3DH_OUT_ADC1_L           0x08 // ADC output register 1 (low byte)
#define LIS3DH_OUT_ADC1_H           0x09 // ADC output register 1 (high byte)
#define LIS3DH_OUT_ADC2_L           0x0A // ADC output register 2 (low byte)
#define LIS3DH_OUT_ADC2_H           0x0B // ADC output register 2 (high byte)
#define LIS3DH_OUT_ADC3_L           0x0C // ADC output register 3 (low byte)
#define LIS3DH_OUT_ADC3_H           0x0D // ADC output register 3 (high byte)
#define LIS3DH_WHO_AM_I_REG         0x0F // Device identification register

#define LIS3DH_CTRL_REG0            0x1E // Control register 0 (内部 上拉  电阻 控制 )
#define LIS3DH_TEMP_CFG_REG         0x1F // Temperature configuration register
#define LIS3DH_CTRL_REG1            0x20 // Control register 1 (contains ODR and power mode settings)
#define LIS3DH_CTRL_REG2            0x21 // Control register 2 (contains high-pass filter settings)
#define LIS3DH_CTRL_REG3            0x22 // Control register 3 (contains interrupt config)
#define LIS3DH_CTRL_REG4            0x23 // Control register 4 (contains full scale and self-test settings)
#define LIS3DH_CTRL_REG5            0x24 // Control register 5 (contains FIFO and boot config)
#define LIS3DH_CTRL_REG6            0x25 // Control register 6 (contains interrupt pin polarity and 4D/6D config)

#define LIS3DH_REFERENCE_REG        0x26 // Reference value for interrupt generation
#define LIS3DH_STATUS_REG           0x27 // Status register (contains data ready and overrun flags)
#define LIS3DH_OUT_X_L              0x28 // X-axis output register (low byte)
#define LIS3DH_OUT_X_H              0x29 // X-axis output register (high byte)
#define LIS3DH_OUT_Y_L              0x2A // Y-axis output register (low byte)
#define LIS3DH_OUT_Y_H              0x2B // Y-axis output register (high byte)
#define LIS3DH_OUT_Z_L              0x2C // Z-axis output register (low byte)
#define LIS3DH_OUT_Z_H              0x2D // Z-axis output register (high byte)

#define LIS3DH_FIFO_CTRL_REG        0x2E // FIFO control register
#define LIS3DH_FIFO_SRC_REG         0x2F // FIFO source register

#define LIS3DH_INT1_CFG             0x30 // Interrupt 1 configuration register
#define LIS3DH_INT1_SRC             0x31 // Interrupt 1 source register
#define LIS3DH_INT1_THS             0x32 // Interrupt 1 threshold register
#define LIS3DH_INT1_DURATION        0x33 // Interrupt 1 duration register

#define LIS3DH_INT2_CFG             0x34 // Interrupt 2 configuration register
#define LIS3DH_INT2_SRC             0x35 // Interrupt 2 source register
#define LIS3DH_INT2_THS             0x36 // Interrupt 2 threshold register
#define LIS3DH_INT2_DURATION        0x37 // Interrupt 2 duration register

#define LIS3DH_CLICK_CFG            0x38 // Click configuration register
#define LIS3DH_CLICK_SRC            0x39 // Click source register
#define LIS3DH_CLICK_THS            0x3A // Click threshold register
#define LIS3DH_TIME_LIMIT           0x3B // Time limit register for click function
#define LIS3DH_TIME_LATENCY         0x3C // Time latency register for click function
#define LIS3DH_TIME_WINDOW          0x3D // Time window register for click function
#define LIS3DH_ACT_THS              0x3E // Sleep-to-wake, return-to-sleep activation threshold in low-power mode
#define LIS3DH_ACT_DUR              0x3F // Sleep-to-wake, return-to-sleep duration

void LIS3DH_Init(void);
void I2C_Init();
void ReadNbyte(unsigned char  addr, unsigned char *p, unsigned char number);
void WriteNbyte(unsigned char addr, unsigned char *p, unsigned char number) ;

#endif